package operations;

import book.BookList;

import java.util.Scanner;

public class BorrowOperation implements IOperations{
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入你要借阅的图书名");
        Scanner scanner = new Scanner(System.in);
        String bookName = scanner.nextLine();
        int length = bookList.getUsedSize();
        for (int i = 0; i < length; i++) {
            if(bookList.getBook(i).getName().equals(bookName)){
                bookList.getBook(i).setIsBorrowed(true);
                System.out.println("借阅成功");
                return;
            }
        }
        System.out.println("没有这本书");
    }
}
